/**
 * Created by john on 2018/11/3.
 */
const NodeCache = require("node-cache");   //缓存 token -> 用户信息 ,
const myCache = new NodeCache({  stdTTL : 60*60 ,  checkperiod : 10 });

const  COMM = require("./comm");



myCache.on("expired",function(key,value){
    console.log(key,value);//当过期之后，通知各方子服务，退出登录
    COMM.loginOut(value._app,"");
});

//var res = myCache.set("key",{name:"mannymu"},60*60); //过期时间为秒

module.exports = myCache;